import request from '@/config/axios'

// 信息源 VO
export interface DataSourceVO {
  id: number // 主键
  name: string // 信息源名称
  enable: boolean // 是否启用
  brokerId: number //转发服务ID
  brokerName: string //转发服务名称
}

// 信息源 API
export const DataSourceApi = {
  // 查询信息源分页
  getDataSourcePage: async (params: any) => {
    return await request.get({ url: `/forward/data-source/page`, params })
  },

  // 查询信息源详情
  getDataSource: async (id: number) => {
    return await request.get({ url: `/forward/data-source/get?id=` + id })
  },

  // 新增信息源
  createDataSource: async (data: DataSourceVO) => {
    return await request.post({ url: `/forward/data-source/create`, data })
  },

  // 修改信息源
  updateDataSource: async (data: DataSourceVO) => {
    return await request.put({ url: `/forward/data-source/update`, data })
  },

  // 删除信息源
  deleteDataSource: async (id: number) => {
    return await request.delete({ url: `/forward/data-source/delete?id=` + id })
  },

  // 导出信息源 Excel
  exportDataSource: async (params) => {
    return await request.download({ url: `/forward/data-source/export-excel`, params })
  },
}
